import locales from './locale';
import registerLocales from "../core/entry/utils/registerLocales";
registerLocales(locales)

//@ts-ignore, 所有异步加载的组件
const basicContext = require['context'](
    './',
    true,
    /\.(\/[a-zA-Z0-9]+)\/index\.ts(x?)$/i,
    'lazy',
);
export default basicContext.keys().reduce((modules: any, path: string) => {
    const key = path.split('/')[1];
    modules[key.toLowerCase()] = () => basicContext(path);
    return modules;
}, {});


const syncData = {}
const syncContext = require['context']('./SyncComponents', true, /\.(\/[a-zA-Z0-9]+)\/index\.ts(x?)$/i);
syncContext.keys().forEach(path => {
    const key = path.split('/')[1];
    syncData[key.toLowerCase()] = syncContext(path)
});
export {
    syncData
}
